package com;

import java.net.Socket;
import java.sql.Connection;

/**
 * 第6种和第7种的结合, 让第7中拥有懒加载的特性
 */
public final class Singleton8 {
    // 实例变量
    private String name = "1234";
    private Connection conn;
    private Socket socket;


    private Singleton8() {
    }

    private enum EnumHolder {

        INSTANCE;

        private Singleton8 instance;

        EnumHolder() {
            instance = new Singleton8();
        }

        public Singleton8 getInstance() {
            return instance;
        }
    }

    public static Singleton8 getInstance() {
        return EnumHolder.INSTANCE.getInstance();
    }
}
